﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TianShiProject.Models.CarService.Upkeeps;
using TianShiProject.Models.Common;
using Volo.Abp.Application.Services;

namespace TianShiProject.CarService.Upkeeps
{
    public class UpkeepService : ApplicationService
    {
        private readonly IUpkeepRepository _upkeepRepository;
        public UpkeepService(IUpkeepRepository upkeepRepository)
        {
            _upkeepRepository = upkeepRepository;
        }
        /// <summary>
        /// 显示保养记录
        /// </summary>
        /// <param name="name"></param>
        /// <param name="time"></param>
        /// <param name="cardnumber"></param>
        /// <param name="pageindex"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public async Task<PageResponse<UpkeepDto>> GetShowUpkeep(string name, DateTime? time, string cardnumber, int pageindex = 1, int pagesize = 3)
        {
            return await _upkeepRepository.GetShowUpkeep(name, time, cardnumber, pageindex, pagesize);
        }
        /// <summary>
        /// 删除保养记录
        /// </summary>
        /// <returns></returns>
        public async Task<int> DeleteDelUpkeep(int id)
        {
            return await _upkeepRepository.DeleteDelUpkeep(id);
        }
        /// <summary>
        /// 批量删除保养记录
        /// </summary>
        /// <returns></returns>
        public async Task<int> DeleteDelsUpkeep(string ids)
        {
            return await _upkeepRepository.DeleteDelsUpkeep(ids);
        }
        /// <summary>
        /// 编辑修改
        /// </summary>
        /// <param name="upkeepDto"></param>
        /// <returns></returns>
        public async Task<int> PutUpdateUpkeep(UpkeepDto upkeepDto)
        {
            return await _upkeepRepository.PutUpdateUpkeep(upkeepDto);
        }
        /// <summary>
        /// 添加保养记录
        /// </summary>
        /// <param name="upkeepDto"></param>
        /// <returns></returns>
        public async Task<int> PostAddUpkeep(UpkeepDto upkeepDto)
        {
            return await _upkeepRepository.PostAddUpkeep(upkeepDto);
        }
    }
}
